<?php
	$sess = session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>APO Cooperative Database System - Home</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="css/ui-lightness/jquery-ui-1.8rc2.custom.css" />
</head>
<body>
<div class="container ui-corner-all">
	<div class="header ui-corner-top">
  		<h1>APO Cooperative Database System</h1>
	</div>
<div class="divider"></div>
  <div class="wrapper">
    <div class="content">
    	<?php
			if (isset($_SESSION['stat'],$_SESSION['msg']))
			{
				if($_SESSION['stat'] == "login_error")
				{
					echo "<div class=\"ui-state-error\" style=\"width: 90%\">".$_SESSION['msg']."</div>";
				}
				else if ($_SESSION['stat'] == "create_success")
				{
					echo "<div class=\"ui-state-highlight\" style=\"width: 90%\">".$_SESSION['msg']."</div>";
				}
				else if ($_SESSION['stat'] == "logout")
				{
					echo "<div class=\"ui-state-highlight\" style=\"width: 90%\">".$_SESSION['msg']."</div>";
				}
				unset($_SESSION['stat'], $_SESSION['msg']);
			}
		?>
      <h1>Welcome to APO Cooperative Database System</h1>
      <p>
      <?php
	  	if(isset($_SESSION['user']))
		{
			if($_SESSION['pos'] == "Manager")
			{
				echo "Click <a href=\"managerpage.php\">here</a> to proceed to your profile page<br />";
			}
			else
			{
				echo "Click <a href=\"employeepage.php\">here</a> to Proceed to your profile page<br />";
			}
		}
		else
			echo "<p>Please log in to use the system.</p>"
	  ?>
      </p>
    </div></div>
  <div class="login ui-corner-all">
    <div class="navheader ui-corner-top"></div>
  	<div class="userstat">
    <?php
    	if($if = isset($_SESSION['user']))
		{
			echo "<p>You are logged in as: <br/>".$_SESSION['name']."<br/></p>";
			if($_SESSION['pos'] == "Manager")
			{
				echo "<a href=\"managerpage.php\">Proceed to your profile page</a><br />";
			}
			else
			{
				echo "<a href=\"employeepage.php\">Proceed to your profile page</a><br />";
			}
			echo "<a href=\"logOut.php\">Log Out</a><br />";
		}
		else
		{
			echo 
			"<form action=\"logInController.php\" method=\"post\">
			Username: <br />
			<input type=\"text\" name=\"username\" /><br />
			Password:<br />
			<input type=\"password\" name=\"password\"  /><br />
			<br />
			<input type=\"submit\"  />
			</form>	
			<a href=\"createAccountView.php\">Register</a>";
		}
	?>
    </div>
    </div>
    <div class="footer ui-corner-bottom">
    <a href="#">Contact Us</a> | <a href="#">Terms of Use</a> | <a href="#">Trademarks</a> | <a href="#">Privacy Statement</a><br />
    Copyright &copy; 2009 . All Rights Reserved.
  </div>
</div>
</body>
</html>

